! Convert all the parameters in an AssociativeArray to their equivalent Lua * types and insert them into the table on the top of the stack. Presently, * only number, string, and boolean values are converted. */
| 96 | * only number, string, and boolean values are converted. |
| 97 | */ |
| 98 | void |
| 99 | SetLuaVariables(lua_State* state, Hash* parameters) |
| 100 | { |
| 101 | for (HashIterator iter = parameters->begin(); iter != parameters->end(); |
| 102 | iter++) |
| 103 | { |
| 104 | switch (iter->second->getType()) |
| 105 | { |
| 106 | case Value::NumberType: |
| 107 | lua_pushstring(state, iter->first.c_str()); |
| 108 | lua_pushnumber(state, iter->second->getNumber()); |
| 109 | lua_settable(state, -3); |
| 110 | break; |
| 111 | case Value::StringType: |
| 112 | lua_pushstring(state, iter->first.c_str()); |
| 113 | lua_pushstring(state, iter->second->getString().c_str()); |
| 114 | lua_settable(state, -3); |
| 115 | break; |
| 116 | case Value::BooleanType: |
| 117 | lua_pushstring(state, iter->first.c_str()); |
| 118 | lua_pushboolean(state, iter->second->getBoolean()); |
| 119 | lua_settable(state, -3); |
| 120 | break; |
| 121 | default: |
| 122 | break; |
| 123 | } |
| 124 | } |
| 125 | } |
no test coverage detected