Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Lua
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Modules === Besides standard library (core) modules it is possible to write extensions using the Lua API. Extension modules are [[Library (computing)#Dynamic linking|shared objects]] which can be used to extend the functions of the interpreter by providing native facilities to Lua scripts. Lua scripts may load extension modules using <code>require</code>,<ref name="luarefman"/> just like modules written in Lua itself, or with <code>package.loadlib</code>.<ref>{{Cite web |title=Lua 5.4 Reference Manual |url=https://www.lua.org/manual/5.4/manual.html#pdf-package.loadlib |first1=Roberto |last1=Ierusalimschy |first2=Luiz Henrique |last2=de Figueiredo |first3=Waldemar |last3=Celes |access-date=2022-06-01 |website=Lua}}</ref> When a C library is loaded via {{ml-lua|foo}} Lua will look for the function <code>luaopen_foo</code> and call it, which acts as any C function callable from Lua and generally returns a table filled with methods. A growing set of modules termed ''rocks'' are available through a [[package management system]] named [[LuaRocks]],<ref>{{cite web |url=https://luarocks.org/ |title=LuaRocks |publisher=luarocks.org |access-date=2009-05-24}}</ref> in the spirit of [[CPAN]], [[RubyGems]] and [[Python eggs]]. Prewritten Lua [[Language binding|bindings]] exist for most popular programming languages, including other scripting languages.<ref>{{cite web |url=http://lua-users.org/wiki/BindingCodeToLua |title=Binding Code To Lua |publisher=Lua-users wiki |access-date=2009-05-24 |url-status=dead |archive-url=https://web.archive.org/web/20090727080345/http://lua-users.org/wiki/BindingCodeToLua |archive-date= Jul 27, 2009}}</ref> For C++, there are a number of template-based approaches and some automatic binding generators.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Lua
(section)
Add topic