🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to script entities in c++ game with Lua

Started by
5 comments, last by ddlox 3 years, 7 months ago

Hello, I was reading a lot on the internet but I am still looking for an answer, I dont expect a solution from you, just a simple answers or a books, online tutorials which will help me to solve that problem. Well I am coding a game for fun in c++, SFML, where I load entities like NPC, tiles from JSON file. Now I discovered LUA to use it as a scripts for s NPC and tiles and make them able to move, open dialog box etc. But I totally dont have idea how to make it. First of all I embed LUA to c++ and everything works well, I passed simple tutorials for begginers to know what exactly lua is, but I have no idea and I cant find on internet good sources which will help me with communicaton my entities objects from c++ and lua scripts and vice versa, like idk how to exactly make that communication well between entities and scripts and c++, can you help me a bit somehow?

Advertisement

bit old, but have u seen this: https://eliasdaler.wordpress.com/2015/08/10/using-lua-and-cpp-in-practice/​​

and if u want to cut npc mushrooms with lua coroutines , here is how:

https://stackoverflow.com/questions/6175507/using-lua-to-define-npc-behaviour-in-a-c-game-engine

should get u going;

have fun ?

@undefined thank u for reply, first page doesnt work

i don't know why gamedev.net has this problem but sometimes it doesn't save links properly…. maybe a mod should look into this issue (it happens a lot actually, sorry if it has already been raised @khawk)

@programmist94sealand I've tried to re-edit, try again, if not just copy and paste it and be done with it ?

Until then ?

Great, thank you very much,scripting works amazing, I sued LuaBridge libary also.

wonderful ?

This topic is closed to new replies.

Advertisement