33-import (luerl_lib , [lua_error /2 ]).
44
55-export ([coerce /1 , coerce_nil /0 , coerce_userdata /1 , wrap_fun /1 , wrap_trans_fun /1 , sandbox_fun /1 ,
6- get_table_keys /2 , get_table_keys_dec /2 , get_private /2 , set_table_keys /3 , load /2 ,
7- load_file /2 , eval /2 , eval_dec /2 , eval_file /2 , eval_file_dec /2 , eval_chunk /2 , eval_chunk_dec /2 ,
8- call_function /3 , call_function_dec /3 , alloc /2 , proplist_to_map /1 ]).
6+ get_table_keys /2 , get_private /2 , set_table_keys /3 , load /2 , load_file /2 , eval /2 , eval_file /2 ,
7+ eval_chunk /2 , call_function /3 , alloc /2 , proplist_to_map /1 ]).
98
109% This could be improved on perhaps
1110proplist_to_map (Term ) when is_list (Term ) ->
@@ -175,16 +174,6 @@ get_table_keys(Lua, Keys) ->
175174 to_gleam (Other )
176175 end .
177176
178- get_table_keys_dec (Lua , Keys ) ->
179- case luerl :get_table_keys_dec (Keys , Lua ) of
180- {ok , nil , _ } ->
181- {error , key_not_found };
182- {ok , Value , _ } ->
183- {ok , Value };
184- Other ->
185- to_gleam (Other )
186- end .
187-
188177set_table_keys (Lua , Keys , Value ) ->
189178 SetFun = case is_encoded (Value ) of
190179 true -> fun luerl :set_table_keys /3 ;
@@ -204,38 +193,17 @@ eval(Lua, Code) ->
204193 to_gleam (luerl :do (
205194 unicode :characters_to_list (Code ), Lua )).
206195
207- eval_dec (Lua , Code ) ->
208- to_gleam (luerl :do_dec (
209- unicode :characters_to_list (Code ), Lua )).
210-
211196eval_chunk (Lua , Chunk ) ->
212197 to_gleam (luerl :call_chunk (Chunk , Lua )).
213198
214- eval_chunk_dec (Lua , Chunk ) ->
215- call_function_dec (Lua , Chunk , []).
216-
217199eval_file (Lua , Path ) ->
218200 to_gleam (luerl :dofile (
219201 unicode :characters_to_list (Path ), Lua )).
220202
221- eval_file_dec (Lua , Path ) ->
222- to_gleam (luerl :dofile_dec (
223- unicode :characters_to_list (Path ), Lua )).
224-
225203call_function (Lua , Fun , Args ) ->
226204 {EncodedArgs , State } = encode_list (Args , Lua ),
227205 to_gleam (luerl :call (Fun , EncodedArgs , State )).
228206
229- call_function_dec (Lua , Fun , Args ) ->
230- {EncodedArgs , St1 } = encode_list (Args , Lua ),
231- case luerl :call (Fun , EncodedArgs , St1 ) of
232- {ok , Ret , St2 } ->
233- Values = luerl :decode_list (Ret , St2 ),
234- {ok , {St2 , Values }};
235- Other ->
236- to_gleam (Other )
237- end .
238-
239207get_private (Lua , Key ) ->
240208 try
241209 {ok , luerl :get_private (Key , Lua )}
0 commit comments