Guest Red Ocktober Posted February 25, 2010 Share Posted February 25, 2010 i keep getting a "Unhandled Exception:Attempt to access field or method of null object error at this point... Function GetStackSize:Int() Return lua_gettop(luastate.L) EndFunction what the heck am i doing wrong... spent an hour playing with this f####er... this is the code (from fwtest that josh posted)... SuperStrict Framework leadwerks.engine Import "C:\Program files\Leadwerks Engine SDK231\BMX\Framework\Framework.bmx" Import lugi.generator 'To generatue glue functions for Lua, comment this line out: Include "lua-gluefunctions.bmx" 'And uncomment these two lines, run the program once, Then undo your changes: 'generateGlueCode("lua-gluefunctions.bmx") 'End Local world:TWorld Local gbuffer:TBuffer Local camera:TCamera Local mesh:TMesh Local light:TLight Local ground:TMesh Local material:TMaterial GCSetMode(2) RegisterAbstractPath( "C:/program files/Leadwerks Engine SDK231" ) Graphics(800,600) Local fw:TFramework THANKS --Mike Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 25, 2010 Share Posted February 25, 2010 do you have this entire code in your bmax program? Function SetScriptObject(name:String, o:Object) Local size:Int=GetStackSize() lua_pushbmaxobject(luastate.L,o) lua_setglobal(luastate.L,name) SetStackSize(size) EndFunction Function GetStackSize:Int() Return lua_gettop(luastate.L) EndFunction Function SetStackSize(size:Int) Local currentsize:Int=GetStackSize() If size<currentsize lua_pop(luastate.L,currentsize-size) EndIf EndFunction are you setting the ScriptObject? Global fw:TFramework = TFramework.Create() If Not fw RuntimeError "Failed to initialize engine." SetScriptObject("fw", fw) 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...
AndyGFX Posted February 25, 2010 Share Posted February 25, 2010 When you have done above post and problem still, try rebuild leadwerks mod. bmk makemods leadwers from bin folder of blitzmax folder. this help you Quote [HW] C2D Q6600, 4GB RAM, NV8800GTX, Vista Ultimate x64 [sW] Blide Plus, BlitzMax, Delphi, C++, 3DWS 5.53, Leadwerks 2.xx Link to comment Share on other sites More sharing options...
macklebee Posted February 25, 2010 Share Posted February 25, 2010 have you created your own lua-gluefunctions.bmx file? I would suggest doing that as well. SuperStrict Framework leadwerks.engine Import "C:\Program files\Leadwerks Engine SDK231\BMX\Framework\Framework.bmx" Import lugi.generator AppTitle:String = "Create Lua Functions" generateGlueCode("lua-gluefunctions.bmx") Notify("All Done", 0) End 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...
Marleys Ghost Posted February 25, 2010 Share Posted February 25, 2010 Try simply copying Newton.dll and the scripts folder to your app dir. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
macklebee Posted February 25, 2010 Share Posted February 25, 2010 Try simply copying Newton.dll and the scripts folder to your app dir. hehe... surely he is doing that! 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...
Guest Red Ocktober Posted February 25, 2010 Share Posted February 25, 2010 THANKS Guys.... looking at all now.... --Mike Quote Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 25, 2010 Share Posted February 25, 2010 hehe... surely he is doing that! well if hes just downloaded the fwtest.zip then all he will have in the extracted dir is fwtest.bmx and lua-gluefunctions.bmx ... pointing to the framework folder and registering the abstract path to the SDK isnt enough .. need to have the scripts folder and newton.dll in the appdir to run the code... is something that can be easily overlooked. Thought it best to try there .. Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted February 26, 2010 Share Posted February 26, 2010 did everything suggested (btw thanks verrry much everyone)... still can't run fwtest without getting that same error... it seems as if the framework is being created... 'Set the global lua variable "fw" to the framework object so Lua can access it:' SetScriptObject("fw",fw) If Not fw RuntimeError "Failed to create framework." doesn't fail there... still fails trying to call one of the lua functions below... Function GetStackSize:Int() Return lua_gettop(luastate.L) EndFunction i'm probably forgetting to do something really simple... (still recovering from two weeks of intensive legal stuff, so my mind is still not right ) --Mike Quote Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 26, 2010 Share Posted February 26, 2010 run through your workflow from unpacking fwtest.zip Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted February 26, 2010 Share Posted February 26, 2010 ok... after five minutes (and a lot of cursing and swearing )... i finally found the cause of my frustrations... 'Local fw:TFramework=CreateFramework()' Global fw:TFramework = TFramework.Create() i commented out the above fw creation code and added the one below... actually, i didn't have any of that code in the original last night... i guess Forest was right... "stoopid is as stoopid does" anyways... another THANK YOU guys for taking the time to help me out... your insights helped point me in the right direction... ya know... it seems as if LW is gradually become best suited for lua coding... i had no problem running and compiling (to psuedocode) the lua stuff... and i can see that if we get a macintosh build, lua will probably be the first best way to access LW... just an observation... as i still have to wrap my head totally around lua, and the speed considerations are a concern (though, so far speed seems acceptable)... now lets see if i can get a simple c++ piece of code to work... in less than a days time --Mike Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 26, 2010 Share Posted February 26, 2010 glad you found it. 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...
Marleys Ghost Posted February 26, 2010 Share Posted February 26, 2010 I used the fwtest code as was simply unpacked to a new folder added the scripts folder and the newton.dll to the app dir. and set the path for absrtact and to framework.bmx .... and had to change nothing code wise. sill using: Local fw:TFramework=CreateFramework() If Not fw RuntimeError "Failed to create framework." Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Guest Red Ocktober Posted February 26, 2010 Share Posted February 26, 2010 hhhhmmmmmmmmmmmmmm !!! the plot thickens --Mike Quote 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.