Well I am looking into savegames and settings saving. At the moment I am writing my test variable value to the save.lua file. However, I don;t want people do change that lua file. That is why I want to convert it to luac.
require("Scripts/constants/engine_const")
--registering the abstract path
RegisterAbstractPath("")
--Set a graphics mode
Graphics(800,600)
--Framework object
fw = CreateFramework()
--set camera
camera = fw.main.camera
camera:SetPosition(Vec3(0,2,-10))
test = 1
--main function
while KeyHit(KEY_ESCAPE)==0 do
if KeyHit(KEY_1)==1 then
test = 1
elseif KeyHit(KEY_2)==1 then
test = 2
elseif KeyHit(KEY_3)==1 then
test = 3
end
--Open the save.lua file
if KeyHit(KEY_O)==1 then
dofile("abstract::save.lua")
end
--Write the test value in save.lua
if KeyHit(KEY_S)==1 then
file = io.open("save.lua","w") --Open in Write mode
if file == nil then
Notify("there is no file")
end
file:write("test = " .. test)
file:close()
end
fw:Update()
fw:Render()
SetBlend(1)
DrawText(" Use 1, 2 and 3 to set value",0,30)
DrawText(" S = saving - O = open",0,60)
DrawText(test,0,90)
SetBlend(0)
Flip(0)
end