public subroutine aot_table_push(L, thandle, key, pos, toptype)
This subroutine tries to push the value of the entry given by key or pos
within the table thandle onto the Lua stack.
If no corresponding value is found, a nil value is pushed to the stack.
Key, pos and thandle are all optional.
If no thandle is provided, the key will be obtained as a global variable.
When none of thandle, key and pos are provided, the subroutine does
nothing and the resulting type returned in toptype is the type of the
current top entry in the Lua stack.
Passing only pos without thandle is illegal and will result in a NIL
value on the top of the stack.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Source Code
subroutine aot_table_push(L,thandle,key,pos,toptype)type(flu_state)::L!! Handle for the Lua script.!> Handle to the table to look in.integer,intent(in),optional::thandle!> Name of the entry to push to the stack.character(len=*),intent(in),optional::key!> Position of the entry to push to the stack.integer,intent(in),optional::posinteger,intent(out),optional::toptypeinteger::loctypeloctype=FLU_TNIListable:if(present(thandle))then if(thandle/=0)then! Only proceed if thandle is actually a table! (Should be received with aot_table_global or aot_table_top)if(present(key))then! Try to look up the given key firstloctype=flu_getfield(L,thandle,key)if((loctype==FLU_TNONE).or.(loctype==FLU_TNIL))then! If this is not found, try to retrieve! the value at the given positionif(present(pos))then call flu_pop(L)call flu_pushInteger(L,pos)loctype=flu_getTable(L,thandle)end if end if else! No key to look up, just check the given positionif(present(pos))then call flu_pushInteger(L,pos)loctype=flu_getTable(L,thandle)else! Neither key nor pos present, nothing to look up! Just push a NIL onto the stack as a resultcall flu_pushnil(L)end if end if else call flu_pushnil(L)end if else istableif(present(key))then! Try to look up the given key as a global variableloctype=flu_getglobal(L,key)else! No key, no thandle, treat this as a no-op if also no pos is provided! and return the type of the current top of the Lua stack.if(present(pos))then! Passing pos without thandle is illegal, and we always push a NIL! in this case.call flu_pushnil(L)elseloctype=flu_type(L,-1)end if end if end if istableif(present(toptype))thentoptype=loctypeend if end subroutine aot_table_push