Josh Posted December 30, 2009 Share Posted December 30, 2009 This example shows how to use BlitzMax, Framework, and Lua together seamlessly! Framework is a little different from the main engine. Although it is compiled into the DLL, it is not compiled into the engine module. This allows the programmer to make their own customizations to the code. However, it also means we have to generate a code file of glue functions for Lua to be able to access the Framework commands. The attached example shows how to do this. You can also use this method to expose your own BlitzMax types to Lua! Any time your command set changes, you need to regenerate the Lua glue code. This is done by commenting out the line that includes the glue code, and uncommenting the code that generates it: 'Include "lua-gluefunctions.bmx" generateGlueCode("lua-gluefunctions.bmx") End Then switch the comments back to run the program: Include "lua-gluefunctions.bmx" 'generateGlueCode("lua-gluefunctions.bmx") 'End This allows your Lua scripts to access the entire framework command set, as well as your own types. You also need to set the value of the global Lua variable "fw". This is done with the included SetScriptObject() function, which just uses Lua commands to set a variable. The Framework code is distributed as code files instead of a module, mostly because BlitzMax does not allow compiling a module with the name "Framework". fwtest.zip Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
gordonramp Posted December 30, 2009 Share Posted December 30, 2009 Compiler Error.."Can't find interface for module 'lugi.generator'" Quote AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64. Link to comment Share on other sites More sharing options...
macklebee Posted December 30, 2009 Share Posted December 30, 2009 Compiler Error.."Can't find interface for module 'lugi.generator'" Download from here. Run the generator.bmx program in maxide to create the modules inside the .bmx folder. Place those inside the Blitzmax/mod/lugi.mod/generator.mod folder. Granted that line 'Import lugi.generator' is only needed if you need to create a new 'lua-gluefunctions.bmx' file. If you don't need to make a new one, just use the existing 'lua-gluefunctions.bmx' as-is, and it works just fine for getting lua framework commands to work inside bmax. Just don't forget to set all of your SetScriptObjects. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Josh Posted December 30, 2009 Author Share Posted December 30, 2009 I added the missing module to the server, too. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
VicToMeyeZR Posted December 31, 2009 Share Posted December 31, 2009 Download from here. Run the generator.bmx program in maxide to create the modules inside the .bmx folder. Place those inside the Blitzmax/mod/lugi.mod/generator.mod folder. Granted that line 'Import lugi.generator' is only needed if you need to create a new 'lua-gluefunctions.bmx' file. If you don't need to make a new one, just use the existing 'lua-gluefunctions.bmx' as-is, and it works just fine for getting lua framework commands to work inside bmax. Just don't forget to set all of your SetScriptObjects. Module LuGI.Generator I get a compile error from this line in the generator. I just got BMX so I know idea what I am doing yet. Quote AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.