Loading...
  OR  Zero-K Name:    Password:   

Tweakdef lua is fucked

7 posts, 241 views
Post comment
Filter:    Player:  
sort
It seems the Lua interpreter is fucked.

Consider the following:
https://pastebin.com/raw/icJ2yjFC
+0 / -0
Updated the link; the "rounding to ten" error was just a typo by me.
+0 / -0
2 months ago
i will help you if i can tomorrow but i need rest Zzz
+0 / -0


2 months ago
Can you send a string that fails. I don't want to parse an example out of your multi-situation pastebin.
+0 / -0

2 months ago
tweakdefs would be a whole lot easier to work with if errors returned by loadstring(...) were printed to the infolog, instead of being ignored. Right now syntax errors etc. just silently fail.
+2 / -0
Yeah, but thankfully syntax errors can be fixed by parsing the code into a site like https://onecompiler.com/lua to check if it works.

AUrankAdminGoogleFrog I wish I could say which string fails, but I do not know. I simply know that it must be amongst the lines that I included.

Using the function n_in_table in an if-statement works fine in the online lua compiler, but it doesn't work ingame. No idea if it is the if-statement or something in the functon that breaks.

Same with round_to_number and multiply_and_round. Maybe there's a problem when a function passes one of its arguments to another function?

Though I have a function which does this, but works just fine. See and compare:
https://pastebin.com/raw/emrz1Jdf

+0 / -0

2 months ago
quote:
tweakdefs would be a whole lot easier to work with if errors returned by loadstring(...) were printed to the infolog, instead of being ignored. Right now syntax errors etc. just silently fail.

Good point, done
https://github.com/ZeroK-RTS/Zero-K/commit/dd6982c84e72ad55335eda1338e3224303cec5db
+3 / -0