Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

zlib and struct libraries
Started by Nerox Sep 10 2018 09:30 AM

6 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Nerox

[GLOBAL: userInfoPane.html]
Nerox
  • Enthusiast

  • 94 posts
  • Corona SDK

Well, I am in very need of these 2 libraries (zlib and struct), I found a similar zlib library that is written in pure lua but it has some limitations and I also found a struct library written in lua but some functions are also missing,

 

https://github.com/brimworks/lua-zlib

http://www.inf.puc-rio.br/~roberto/struct/

 

Why do I need these libraries ? Well I am creating a windows program which creates excel files, I use the lua xlsx module and the zlib and struct alternative libraries (that are written in lua only) aren't compatible with the xlsx module.

 

my question is can I load these libraries (.dll or .c) using corona ? (will run on windows only)

if not, what can I do ?



[TOPIC: post.html]
#2

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 751 posts
  • Corona SDK

Hi Nerox.

 

Not terribly obvious, I suppose, but I've included struct in my serialize plugin. (It's just that and two other plugins.) I'm afraid I'm no help for zlib, though.



[TOPIC: post.html]
#3

Nerox

[GLOBAL: userInfoPane.html]
Nerox
  • Enthusiast

  • 94 posts
  • Corona SDK

Thanks for the struct plugin I really appreciate it.

Problem is I still need the zlib library in order to fix my problem, If I use corona native will I be able to "just" include (require) the C file in my corona project ?



[TOPIC: post.html]
#4

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 751 posts
  • Corona SDK

You definitely cannot just include the C file.  :D If you're willing to give a DLL a go, see this. You would need to rename luaopen_zlib to luaopen_plugin_zlib along with some other steps that might be mentioned there.



[TOPIC: post.html]
#5

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 163 posts
  • Corona SDK

Curious as to whether you really need to create Excel files at all. Are you just piping out cell data or are you actually creating Excel proprietary elements, like colouring rows in?

If this is just for data then a CSV would be infinitely easier, and is industry standard so can be loaded in to any spreadsheet software, including Excel, and other tools such as CRMs or mailing lists.

To output a CSV you literally just have to pipe out the plain text to a file. Separate the cells using a comma, if the cell content contains a comma wrap it in quotes, and if the quoted text needs to contain a quote just prefix it with another quote. E.g:

Hello,World,"This is, ""my"", data",Foobar

No need for any additional libs or complex code, and the result will be useful for more people.

[TOPIC: post.html]
#6

Nerox

[GLOBAL: userInfoPane.html]
Nerox
  • Enthusiast

  • 94 posts
  • Corona SDK

I've actually thought of CSV but I am not sure if CSV supports formatting (merging cells, bold fonts, coloring cells, etc..)

Also there must be a way that I can do to include zlip, in worst cases I will make a plugin for it myself just as StarCrunch suggested, and If I won't be able to do it I will go for CSV.



[TOPIC: post.html]
#7

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 163 posts
  • Corona SDK

There's no formatting in CSV no, just raw data. If you need formatting then that's reason to use xlsx.


[topic_controls]
[/topic_controls]