Skip to content

Different LUA variable names but same LUA structure #150

Answered by neolithos
DiagProf asked this question in Q&A
Discussion options

You must be logged in to vote

In Lua all data is stored in a table(s), which is a combination of an array and dictionary.

There are multiple ways to access.

C#:

  • If you know the name, or it is fixed: Use the dynamic syntax. This will create on the first a access a little shortcut.
    var raw = (LuaTable)_environment.EMS.Raw; with the cast you can switch between dynamic/static.
  • If you do not know the name or index: Use table.ArrayList or table.Members

Lua:

  • dynamic, like lua, use local raw = EMS.Raw
  • static, use ipairs and mpairs. Or the NeoLua specials rawarray() in combination with foreach.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@DiagProf
Comment options

@neolithos
Comment options

@DiagProf
Comment options

Answer selected by DiagProf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants