Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>My first piece of advise is to not use LUAInterface; as it isn't cross platform, and to instead use IronPython, which is just as easy to pick up as LUA, and will run on Windows and OSX, depending on how you are writing your game; XNA and OpenTK should work cross platform under mono for the graphics engine.</p> <p>i found this out myself when experementing with LUA for my own vb.net based game, and eventually decided on iron python.</p> <p>But assuming you want to stick with LUA; here is something you can try.</p> <p>Based on the fact that you know: Any vb.net code written cannot be changed after run time, you can do something like this:</p> <pre><code>Public Shared Lua as New LuaInterface Sub Game() Dim LuaCaller as New LuaAccess Lua("LuaAccess") = LuaCaller End Sub Public Class LuaAccess Public Sub Grant(NewClass as String, Variable as String) Select Case NewClass Case "LuaAccess" Lua(Variable) = New LuaAccess End Sub End Class </code></pre> <p>Then from Lua:</p> <pre><code>LuaAccess:Grant("LuaAccess", "MyNewLuaAccess") </code></pre> <p>You can add a new case for each class you want lua to be able to create an instance of; and use that to create new instances of classes. if you want it to be able to modify an active class used by the main program, just make the subs, or variables, or both in the class shared</p> <pre><code>Public Shared MyVar as Integer </code></pre> <p>That way there is only one copy of the variable, which any part of the application (even Lua) can modify.</p> <p>Although I'll be honest IronPython really is more suited to this kind of thing, and is still being actively developed, unlike LuaInterface.</p> <p>remember one thing; when it comes to scripting, you really don't want to give the scripting engine too much control; when it comes to games specifically you're giving them access to everything your engine can do; and that can be used to cheat if you are not careful.</p> <p>good luck, and i hope i helped.</p> <p>Based on LuaInterface runtime v2.0.50727 (the one that uses Lua51.dll)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload