Jump to content
MetalAZ

C++ Lua Script:Start() App Is Nil

Recommended Posts

Is this the expected behavior? I got the C++ DLC on Steam and created a new project using C++. I added the awesome water prefab to the map using and the game crashed when I tried to run it. It crashed because App is nil in Script:Start().

Share this post


Link to post

C++ projects do not use an "App" table in Lua. For this reason entity scripts should not expect it to be there.

Share this post


Link to post

Basically the water prefab seems like it will only work with a Lua project at this time because it must be using the App logic somewhere. This is actually an interesting thing which I haven't thought of. I always advocated to just use App.context/window/camera in entity scripts but I see now why that is wrong. I didn't make this water prefab but the person who did probably thought the same thing when they made it. Since Leadwerks for Lua was the first one out everything was working fine, but now that C++ is out these will be broken.

 

Find in Script:Start() of the prefab what variable it's trying to access of App (App.?). There are other functions you can use that won't rely on App to get things like World::GetCurrent(), Context:GetCurrent(), etc. If it's the camera that it's trying to get from App then you'll have to do that another way.

Share this post


Link to post

The waterprefab is kind of outdated and hard to use I will remove it.

I was suppose to make a new one, but was kind of hoping klepto to put his in the workshop instead.

Share this post


Link to post

If it's in the Workshop I would not remove it. It's okay to rename it like "Water Prefab [Legacy]" or something like that.

Share this post


Link to post

Just say Lua version or something because it'll work with that still.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...