Benutzer-Werkzeuge

Webseiten-Werkzeuge


becki:linux:lua

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
becki:linux:lua [2016-03-03 10:42]
becki [C-style ?-operator equivalent]
becki:linux:lua [2026-10-13 12:07] (aktuell)
becki
Zeile 7: Zeile 7:
  
 Use www.slackbuilds.org Use www.slackbuilds.org
 +
 +Note Support for Slack 14.2 is a mess. Use beckis Slack packages for Lua  5.3.1 and Luarocks 2.4.1 --- 2026-10-13 ​
  
 External addons / Packages for Lua: External addons / Packages for Lua:
   * [[http://​luarocks.org/​repositories/​rocks/​|Automated "​Rocks"​]]   * [[http://​luarocks.org/​repositories/​rocks/​|Automated "​Rocks"​]]
   * [[http://​lua-users.org/​wiki/​LibrariesAndBindings|Manual]]   * [[http://​lua-users.org/​wiki/​LibrariesAndBindings|Manual]]
 +
 +Metdata of Luarocks can be found in /​usr/​lib/​luarocks/​rocks/​ after install ​
  
 ===== Implementations == ===== Implementations ==
Zeile 34: Zeile 38:
  
 [[http://​kripken.github.io/​lua.vm.js/​script_example.html|lua.vm.js]] thanks to asm.js [[http://​kripken.github.io/​lua.vm.js/​script_example.html|lua.vm.js]] thanks to asm.js
 +
 +==== Lua for Java/​Android ==
 +
 +[[https://​sourceforge.net/​projects/​luaj/​|Luaj]],​ seen at [[https://​github.com/​M66B/​XPrivacyLua/​blob/​master/​README.md|XPrivacyLua]]
  
 ===== C-style ?-operator equivalent == ===== C-style ?-operator equivalent ==
Zeile 253: Zeile 261:
  
 ===== Classes and Objects == ===== Classes and Objects ==
 +
 +See also projects/​accounting/​sbaccimport which has since rev 482:​c85c255f1870 classes with inheritance where the constructor new() is a class method and can therefore be reused in child classes similar to PIL capter 21 
 ==== Classes as Object templates == ==== Classes as Object templates ==
 <code lua> <code lua>
Zeile 501: Zeile 511:
   - ''"​l"''​ as arg for ''​read()''​ is the default, it can be omitted   - ''"​l"''​ as arg for ''​read()''​ is the default, it can be omitted
   - ''​file:​lines()''​ and ''​io.lines()''​ accept the same format args as ''​read()''​. (Tested. Nowhere found in docu). Thus you could read a file eg chunk by chunk as well.   - ''​file:​lines()''​ and ''​io.lines()''​ accept the same format args as ''​read()''​. (Tested. Nowhere found in docu). Thus you could read a file eg chunk by chunk as well.
 +  - io.lines() without arguments returns an iterater wich returns stdin line by line
  
 +==== Load CSV-like files ==
 +
 +<code lua>
 +#​!/​usr/​bin/​lua
 +local separator=":"​
 +for line in io.lines() do
 +    print(line)
 +    for cell in line:​gmatch("​[^"​..separator.."​]+"​) do
 +        print("",​ cell)
 +    end
 +end
 +</​code>​
 ===== Includes and Modules == ===== Includes and Modules ==
 ==== Include == ==== Include ==
Zeile 759: Zeile 782:
  
 [[http://​stevedonovan.github.io/​ldoc/​topics/​doc.md.html|Ldoc]] is preferred (over [[http://​keplerproject.github.io/​luadoc/​manual.html#​howto|LuaDoc]]). [[http://​stevedonovan.github.io/​ldoc/​topics/​doc.md.html|Ldoc]] is preferred (over [[http://​keplerproject.github.io/​luadoc/​manual.html#​howto|LuaDoc]]).
 +
 +{{tag>​lua}}
 +
becki/linux/lua.1457001720.txt.gz · Zuletzt geändert: 2016-03-03 10:42 von becki

Impressum - Datenschutzerklärung