PtokaX forum

Development Section => LUA & PtokaX-Scripting-Interface => Topic started by: nesmar on 31 October, 2005, 08:15:28

Title: new to LUA, have several questions
Post by: nesmar on 31 October, 2005, 08:15:28
Finding information on LUA is more difficult than most languages so I thought i could ask here. I did find a few anwers, but im not sure if they are correct.

Any help will be appreciated.

1. What is the definition of legal names in LUA? Are name context
sensitive?

2. How the type is specified? When the biding of variable and type takes place?

3. Does your LUA perform static, or dynamic checking? Or both type of
checking?

4. Where in the spectrum of weak typed language to Strong typed language is LUA?

5. Examples or cases where LUA is weak on checking the variable
types.

6. Does LUA allow static variables?

7. Does LUA allow stack-Dynamic variables?

8. Does LUA allow Heap-Dynamic variables?

9. Type of scoping of in LUA.

10. Primitive data types in LUA.

11. How char, strings, and Booleans are handled, (design issues, their operations).

12. How strings are checked?

13. Does LUA provide support for enumeration types?

14. How Arrays are supported? (Design issues, static/dynamic, associative, multidimensional, etc) How are they checked? Are rectangular, and jagged arrays allowed? Does LUA have special features supporting arrays?

15. What about records? How reliable are they?

16. Pointers and reference type, design issues, scope, dynamic storage management.
Title:
Post by: Rincewind on 31 October, 2005, 09:47:20
Check out here (http://www.lua.org/)  for details on Lua
Title:
Post by: plop on 31 October, 2005, 19:11:54
lua gets it's speed from simplicity, there are just variables.
you never have 2 declare the type, but you can check what type it is.
type(variable)

variable isn't the same as Variable.

inside lua arrays are the same as table, indexed by numbers.
on the tables you have total freedom, you can mix all types in any way you like.
tTable = { var, { [1] = var1, [28] = var28}, 374, ["string"] = {var2, var3, 384, string, {something, somethingelse} } }
lua doesn't mind what you do.
but lua has optimized loop functions for both arrays and tables (ipairs/pairs).

from the inside lua is mostly a huge table, and these tables give lua it's speed.
hence string.find, string.sub, etc...
use tables are much as possible 2 get max speed.
a global table works as fast as a local vallue.

when ever you try 2 do math on a string lua will try 2 convert it into a number, but for safety you should always do it yourself.

Booleans are handled a bit different then most other languages.
false is a vallue but handled as nil.
if bBool then

plop
Title:
Post by: Corayzon on 31 October, 2005, 19:39:21
Lua 5.0 Reference Manual (http://www.lua.org/manual/5.0/)

5 - Standard Libraries

5.1 - Basic Functions
5.2 - Coroutine Manipulation
[COLOR=red]5.3 - String Manipulation [/COLOR]  
[COLOR=red]5.4 - Table Manipulation[/COLOR]  
5.5 - [COLOR=red]Mathematical Functions[/COLOR]  
5.6 - Input and Output Facilities
5.7 - Operating System Facilities
5.8 - The Reflexive Debug Interface