sub neural_net.backwardPropagate(inputs() as integer, desiredOutputs() as integer)
lua_getref(L, ref)
if lua_type(L, -1) <> LUA_TTABLE then
Print "error with ref"
sleep
system
endif
lua_pushstring(L, "backwardPropagate")
lua_gettable(L, -2)
lua_newtable(L)
for i as integer = lbound(desiredOutputs) to ubound(desiredOutputs)
lua_pushnumber(L, (i+1))
lua_pushnumber(L, desiredOutputs(i))
lua_settable(L, -3)
next i
lua_newtable(L)
for i as integer = lbound(inputs) to ubound(inputs)
lua_pushnumber(L, (i+1))
lua_pushnumber(L, inputs(i))
lua_settable(L, -3)
next i
If lua_pcall(L, 2, 0, 0) <> 0 Then
print "ERROR:"
Print *lua_tostring(L, 1)
Sleep
system
End If
end sub
sending tables to a lua function
I'm trying to call a lua function from freebasic, constructing two temporary tables as the arguments. The problem is that the function is only receiving one of the tables. Can anyone help me out?
in this code, "ref" is a reference to the lua table that contains the function, created earlier in the program with the lua_ref statement, the table created from the "inputs" array gets passed just fine, but the table created from the "desiredOutputs" array is ending up as nil on the lua side
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement