Set[Game/Team/Unit]RulesParam should allow Tables.
Moderator: Moderators
Set[Game/Team/Unit]RulesParam should allow Tables.
Having the option to have tables for these parameters would be absolutely awesome sauce.
Example: Imbue a unit/team with lots of custom data that can be read and displayed by the UI (obeying vision limitations).
Not sure about the difficulty of implementing this tough.
Example: Imbue a unit/team with lots of custom data that can be read and displayed by the UI (obeying vision limitations).
Not sure about the difficulty of implementing this tough.
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
The bad side of this is that RulesParams data is accessible from everywhere - possibly from different threads on different cores that don't share the same cache, etc etc. So there is an overhead for the transfer (and unfortunately, lua is not a strongly typed language which forces tables to be quite complicated data structures).
If you explain in more detail what data you are trying to send where, someone might be able to offer you a better idea.
If you explain in more detail what data you are trying to send where, someone might be able to offer you a better idea.
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
String parsing...
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
You mean converting the table into a megalong string?
Should work, not sure about how efficient string operations are in lua compared to tables.
Should work, not sure about how efficient string operations are in lua compared to tables.
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
iirc, in general more efficient but still pretty horrible.
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
There is global GG table that is shared among gadgets.
Does that cover your need maybe?
http://springrts.com/wiki/LuaTutorials: ... unications
not explained there yet, hm.
Basically can do like:
GG.myTable[someIndex].bla
etc
Instead of the actual tables being share you can also have a global GG.function.
http://springrts.com/phpbb/viewtopic.php?f=23&t=27025 is simple example. (not the best though, and in this case RulesParam might have been better. but well, as example..)
Does that cover your need maybe?
http://springrts.com/wiki/LuaTutorials: ... unications
not explained there yet, hm.
Basically can do like:
GG.myTable[someIndex].bla
etc
Instead of the actual tables being share you can also have a global GG.function.
http://springrts.com/phpbb/viewtopic.php?f=23&t=27025 is simple example. (not the best though, and in this case RulesParam might have been better. but well, as example..)
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
knorke wrote:There is global GG table that is shared among gadgets.
Erik wrote:custom data that can be read and displayed by the UI
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
1. you don't say anything at all what you are doing (that pisses off any dev when reading such topics)
2. RulesParams are saved in c++ containers and are not lua objects! so saving tables is nearly impossible w/o fuck-ya-brain.
3. you don't need tables in rulesparams, everything there is is enough! (see (1) when you want an answer _how_ to do it right!)
finished (annoyed by improper feature request)
2. RulesParams are saved in c++ containers and are not lua objects! so saving tables is nearly impossible w/o fuck-ya-brain.
3. you don't need tables in rulesparams, everything there is is enough! (see (1) when you want an answer _how_ to do it right!)
finished (annoyed by improper feature request)
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
I've had experience with string parsing. It was really slow. Your best bet at the moment could be to do gadgetHandler:AddSyncAction in the unsynced part of a gadget and then Script.LuaUI.YourWidgetFunction to send it to luaUI. There are a few examples of this spread around ZK.
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
I'm pretty sure SendToUnsynced can't take tables for an argument either.Google_Frog wrote: Your best bet at the moment could be to do gadgetHandler:AddSyncAction in the unsynced part of a gadget and then Script.LuaUI.YourWidgetFunction to send it to luaUI. There are a few examples of this spread around ZK.
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
Googlefrog is not suggesting you use SendToUnsynced, he is suggesting you use AddSyncAction. SendToUnsynced sends to unsynced gadget, not to widget.
(I never tried to send a table via either of them - my advice is don't send complicated data from synced to any unsynced state, just think of more intelligent ways to communicate less data).
(I never tried to send a table via either of them - my advice is don't send complicated data from synced to any unsynced state, just think of more intelligent ways to communicate less data).
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
close please
thread creator is avoiding real solution and ppl create offtopic trails, just increasing confusion & misinformation
thread creator is avoiding real solution and ppl create offtopic trails, just increasing confusion & misinformation
Re: Set[Game/Team/Unit]RulesParam should allow Tables.
not enought details/research/wubwap for feature quest, moved to Lua.