Jump to content

Help With BMax and 2.31


Guest Red Ocktober
 Share

Recommended Posts

Guest Red Ocktober

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

Link to comment
Share on other sites

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)

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

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 :P

[HW] C2D Q6600, 4GB RAM, NV8800GTX, Vista Ultimate x64

[sW] Blide Plus, BlitzMax, Delphi, C++, 3DWS 5.53, Leadwerks 2.xx

 

76561197970156808.pngAndyGFX.png

Link to comment
Share on other sites

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 

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

Try simply copying Newton.dll and the scripts folder to your app dir.

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

hehe... surely he is doing that! :D:P

 

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 .. :D

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

Guest Red Ocktober

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

Link to comment
Share on other sites

run through your workflow from unpacking fwtest.zip

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

Guest Red Ocktober

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 :D

 

--Mike

Link to comment
Share on other sites

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."

 

 

:)

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...